#include <iostream> 
#include <stdio.h>
#include <string.h>
#include <time.h>
#include <fstream>
using namespace std;


#include "bgacomlib.h"
#include <crtdbg.h>
#include <tchar.h>
#include <windows.h>
#include "Serial.h"

//#include "../../../../sqa/serial/serial/serial.h"
using namespace BogozmaCommunicationLibrary;


// Declaration of all boolean variables

// Done
bool testGetType0;
bool testGetType1;
bool testGetType2 = true;

// Not Done
bool testGetMacAddress0;
bool testGetMacAddress1 = true;

// Done
bool testSetGetBaudRate0;
bool testSetGetBaudRate1;
bool testSetGetBaudRate2;
bool testSetGetBaudRate3;
bool testSetGetBaudRate4;
bool testSetGetBaudRate5;
bool testSetGetBaudRate6;
bool testSetGetBaudRate7;
bool testSetGetBaudRate8;
bool testSetGetBaudRate9;
bool testSetGetBaudRate10;
bool testSetGetBaudRate11 = true;

// Done
bool testSetGetParity0;
bool testSetGetParity1;
bool testSetGetParity2;
bool testSetGetParity3;
bool testSetGetParity4 = true;

// Done
bool testSetGetDataBits0;
bool testSetGetDataBits1;
bool testSetGetDataBits2;
bool testSetGetDataBits3 = true;

// Done
bool testSetGetFlowControl0;
bool testSetGetFlowControl1;
bool testSetGetFlowControl2;
bool testSetGetFlowControl3;
bool testSetGetFlowControl4 = true;

// Done
bool testUdpRegRead0;
bool testUdpRegRead1;
bool testUdpRegRead2;
bool testUdpRegRead3;
bool testUdpRegRead4;
bool testUdpRegRead5 = true;

// Done
bool testReadWriteData0;
bool testReadWriteData1;
bool testReadWriteData2;
bool testReadWriteData3 = true;

// Done
bool testSaveConfiguration0;
bool testSaveConfiguration1;
bool testSaveConfiguration2 = true;

// Done
bool testIsAvailable0;
bool testIsAvailable1;
bool testIsAvailable2 = true;

string emessage;
CBgaNetSystem* my_system;
CBgaLinkoo* my_linkoo;


///////////////////////////////////////////////////////////
////////////////////// SET UP /////////////////////////////
///////////////////////////////////////////////////////////

void setUp()
{
	my_system = NULL;
	my_linkoo = NULL;

	my_system = new CBgaNetSystem(eAny);

	//To perform the test we always select the first Device found on the network.
	my_linkoo = (CBgaLinkoo*)my_system->GetDevice(0);
}

///////////////////////////////////////////////////////////
////////////////////// SET UP /////////////////////////////
///////////////////////////////////////////////////////////




///////////////////////////////////////////////////////////
///////////////////// TEAR DOWN ///////////////////////////
///////////////////////////////////////////////////////////

void tearDown()
{  
	if(my_system != NULL)
    {
		delete my_system;
		my_system = NULL;
    }

	my_linkoo = NULL;
}

///////////////////////////////////////////////////////////
///////////////////// TEAR DOWN ///////////////////////////
///////////////////////////////////////////////////////////




///////////////////////////////////////////////////////////
///////////////////// TEST GET TYPE ///////////////////////
///////////////////////////////////////////////////////////

bool testGetType()
{
	if(my_linkoo != NULL)
	{
		testGetType0 = true;
	}
	else
	{
		cout << "Connect a device!" << endl;
		testGetType0 = false;
		return false;
	}

	//process
	try
    {
		if(my_linkoo->GetType() == eLinkoo || my_linkoo->GetType() == ePICDEM2 || my_linkoo->GetType() == eBouboule)
		{
			testGetType1 = true;
		}
		else
		{
			testGetType1 = false;
		}
    }
   
	catch(CBgaException &e)
    {
		cout << e.what() << endl;
		emessage=e.what();
		testGetType2 = false;
    }

	return true;
}

///////////////////////////////////////////////////////////
///////////////////// TEST GET TYPE ///////////////////////
///////////////////////////////////////////////////////////




///////////////////////////////////////////////////////////
////////////////// TEST GET MAC ADDRESS ///////////////////
///////////////////////////////////////////////////////////

bool testGetMacAddress()
{
	if(my_linkoo != NULL)
	{
		testGetMacAddress0 = true;
	}
	else
	{
		cout << "Connect a device!" << endl;
		testGetMacAddress0 = false;
		return false;
	}
	
	//process
	try
    {
		my_linkoo->GetNetworkInfo()->GetMacAddress();//what do I compare it with ??
    }
	
	catch(CBgaException &e)
    {
		cout << e.what() << endl;
		emessage=e.what();
		testGetMacAddress1 = false;
    }

	return true;
}

///////////////////////////////////////////////////////////
////////////////// TEST GET MAC ADDRESS ///////////////////
///////////////////////////////////////////////////////////




///////////////////////////////////////////////////////////
///////////////// TEST SET GET BAUD RATE //////////////////
///////////////////////////////////////////////////////////

bool testSetGetBaudRate()
{
	if(my_linkoo != NULL)
	{
		testSetGetBaudRate0 = true;
	}
	else
	{
		cout << "Connect a device!" << endl;
		testSetGetBaudRate0 = false;
		return false;
	}
	
	//Set up
	my_linkoo->OpenDevice();
	enumBaudRate CurrentBaudRate;

	//Process
	//Get/Set all the possible baud rates in the enumeration. Ensure that they are all settable and readable
	try
	{      
		CurrentBaudRate = my_linkoo->GetBaudRate();

		my_linkoo->SetBaudRate(e110);
		if(my_linkoo->GetBaudRate() == e110)
		{
			testSetGetBaudRate1 = true;
		}
		else
		{
			testSetGetBaudRate1 = false;
		}

		my_linkoo->SetBaudRate(e300);
		if(my_linkoo->GetBaudRate() == e300)
		{
			testSetGetBaudRate2 = true;
		}
		else
		{
			testSetGetBaudRate2 = false;
		}

		my_linkoo->SetBaudRate(e1200);
		if(my_linkoo->GetBaudRate() == e1200)
		{
			testSetGetBaudRate3 = true;
		}
		else
		{
			testSetGetBaudRate3 = false;
		}

		my_linkoo->SetBaudRate(e2400);
		if(my_linkoo->GetBaudRate() == e2400)
		{
			testSetGetBaudRate4 = true;
		}
		else
		{
			testSetGetBaudRate4 = false;
		}

		my_linkoo->SetBaudRate(e4800);
		if(my_linkoo->GetBaudRate() == e4800)
		{
			testSetGetBaudRate5 = true;
		}
		else
		{
			testSetGetBaudRate5 = false;
		}

		my_linkoo->SetBaudRate(e9600);
		if(my_linkoo->GetBaudRate() == e9600)
		{
			testSetGetBaudRate6 = true;
		}
		else
		{
			testSetGetBaudRate6 = false;
		}

		my_linkoo->SetBaudRate(e19200);
		if(my_linkoo->GetBaudRate() == e19200)
		{
			testSetGetBaudRate7 = true;
		}
		else
		{
			testSetGetBaudRate7 = false;
		}

		my_linkoo->SetBaudRate(e38400);
		if(my_linkoo->GetBaudRate() == e38400)
		{
			testSetGetBaudRate8 = true;
		}
		else
		{
			testSetGetBaudRate8 = false;
		}

		my_linkoo->SetBaudRate(e57600);
		if(my_linkoo->GetBaudRate() == e57600)
		{
			testSetGetBaudRate9 = true;
		}
		else
		{
			testSetGetBaudRate9 = false;
		}

		my_linkoo->SetBaudRate(e115200);
		if(my_linkoo->GetBaudRate() == e115200)
		{
			testSetGetBaudRate10 = true;
		}
		else
		{
			testSetGetBaudRate10 = false;
		}

		my_linkoo->SetBaudRate(CurrentBaudRate);
	}
   
	catch(CBgaException &e)
    {
		cout << e.what() << endl;
		emessage=e.what();
		testSetGetBaudRate11 = false;
    }

	my_linkoo->CloseDevice();

	return true;
}

///////////////////////////////////////////////////////////
///////////////// TEST SET GET BAUD RATE //////////////////
///////////////////////////////////////////////////////////




///////////////////////////////////////////////////////////
/////////////////// TEST SET GET PARITY ///////////////////
///////////////////////////////////////////////////////////

bool testSetGetParity()
{   
	if(my_linkoo != NULL)
	{
		testSetGetParity0 = true;
	}
	else
	{
		cout << "Connect a device!" << endl;
		testSetGetParity0 = false;
		return false;
	}
	
	//Set up
	my_linkoo->OpenDevice();
	enumParity CurrentParity;

	//Process
	try
    {      
		CurrentParity = my_linkoo->GetParity();

		my_linkoo->SetParity(eNoParity);
		if((my_linkoo->GetParity() == eNoParity))
		{
			testSetGetParity1 = true;
		}
		else
		{
			testSetGetParity1 = false;
		}

		my_linkoo->SetParity(eEvenParity);
		if(my_linkoo->GetParity() == eEvenParity)
		{
			testSetGetParity2 = true;
		}
		else
		{
			testSetGetParity2 = false;
		}

		my_linkoo->SetParity(eOddParity);
		if(my_linkoo->GetParity() == eOddParity)
		{
			testSetGetParity3 = true;
		}
		else
		{
			testSetGetParity3 = false;
		}

		my_linkoo->SetParity(CurrentParity);
    }
	
	catch(CBgaException &e)
    {
		cout << e.what() << endl;
		emessage=e.what();
		testSetGetParity4 = false;
    }

	my_linkoo->CloseDevice();
	return true;
}

///////////////////////////////////////////////////////////
/////////////////// TEST SET GET PARITY ///////////////////
///////////////////////////////////////////////////////////




///////////////////////////////////////////////////////////
///////////////// TEST SET GET DATE BITS //////////////////
///////////////////////////////////////////////////////////

bool testSetGetDataBits()
{
	if(my_linkoo != NULL)
	{
		testSetGetDataBits0 = true;
	}
	else
	{
		cout << "Connect a device!" << endl;
		testSetGetDataBits0 = false;
		return false;
	}
	
	//Set up
	my_linkoo->OpenDevice();
	enumDataBits CurrentDataBits;

	//Process
	try
    {      
		CurrentDataBits = my_linkoo->GetDataBits();

		my_linkoo->SetDataBits(e7bits);
		if(my_linkoo->GetDataBits() == e7bits)
		{
			testSetGetDataBits1 = true;
		}
		else
		{
			testSetGetDataBits1 = false;
		}

		my_linkoo->SetDataBits(e8bits);
		if(my_linkoo->GetDataBits() == e8bits)
		{
			testSetGetDataBits2 = true;
		}
		else
		{
			testSetGetDataBits2 = false;
		}

		my_linkoo->SetDataBits(CurrentDataBits);
	}

	catch(CBgaException &e)
    {
		cout << e.what() << endl;
		emessage=e.what();
		testSetGetDataBits3 = false;
    }

   my_linkoo->CloseDevice();

   return true;
}

///////////////////////////////////////////////////////////
///////////////// TEST SET GET DATE BITS //////////////////
///////////////////////////////////////////////////////////




///////////////////////////////////////////////////////////
//////////////// TEST SET GET FLOW CONTROL ////////////////
///////////////////////////////////////////////////////////

bool testSetGetFlowControl()
{
	if(my_linkoo != NULL)
	{
		testSetGetFlowControl0 = true;
	}
	else
	{
		cout << "Connect a device!" << endl;
		testSetGetFlowControl0 = false;
		return false;
	}
	
	//Set up
	my_linkoo->OpenDevice();
	enumFlowControl CurrentFlowControl;   

	//Process
	try
    {      
		CurrentFlowControl = my_linkoo->GetFlowControl();

		my_linkoo->SetFlowControl(eNoFlowControl);
		if(my_linkoo->GetFlowControl() == eNoFlowControl)
		{
			testSetGetFlowControl1 = true;
		}
		else
		{
			testSetGetFlowControl1 = false;
		}

		my_linkoo->SetFlowControl(eHardwareFlowControl);
		if(my_linkoo->GetFlowControl() == eHardwareFlowControl)
		{
			testSetGetFlowControl2 = true;
		}
		else
		{
			testSetGetFlowControl2 = false;
		}

		my_linkoo->SetFlowControl(eSoftwareFlowControl);
		if(my_linkoo->GetFlowControl() == eSoftwareFlowControl)
		{
			testSetGetFlowControl3 = true;
		}
		else
		{
			testSetGetFlowControl3 = false;
		}

		my_linkoo->SetFlowControl(CurrentFlowControl);
	}

	catch(CBgaException &e)
    {
		cout << e.what() << endl;
		emessage=e.what();
		testSetGetFlowControl4 = false;
    }

	my_linkoo->CloseDevice();
	return true;
}

///////////////////////////////////////////////////////////
//////////////// TEST SET GET FLOW CONTROL ////////////////
///////////////////////////////////////////////////////////




///////////////////////////////////////////////////////////
//////////////////// TEST UDP REG READ ////////////////////
///////////////////////////////////////////////////////////

bool testUdpRegRead()
{
	if(my_linkoo != NULL)
	{
		testUdpRegRead0 = true;
	}
	else
	{
		cout << "Connect a device!" << endl;
		testUdpRegRead0 = false;
		return false;
	}
	
	enumFlowControl TcpFlowControl;
	enumDataBits    TcpDataBits;
	enumParity      TcpParity;
	enumBaudRate    TcpBaudRate;

	enumFlowControl UdpFlowControl;
	enumDataBits    UdpDataBits;
	enumParity      UdpParity;
	enumBaudRate    UdpBaudRate;

	try
    {
		my_linkoo->OpenDevice();

		TcpFlowControl = my_linkoo->GetFlowControl();
		TcpDataBits = my_linkoo->GetDataBits();
		TcpParity = my_linkoo->GetParity();
		TcpBaudRate = my_linkoo->GetBaudRate();

		//Logoff to force UDP register reads
		my_linkoo->CloseDevice();

		UdpFlowControl = my_linkoo->GetFlowControl();
		UdpDataBits = my_linkoo->GetDataBits();
		UdpParity = my_linkoo->GetParity();
		UdpBaudRate = my_linkoo->GetBaudRate();

		//Verify that we read the same values over UDP.
		if(UdpFlowControl == TcpFlowControl)
		{
			testUdpRegRead1 = true;
		}
		else
		{
			testUdpRegRead1 = false;
		}

		if(UdpDataBits == TcpDataBits)
		{
			testUdpRegRead2 = true;
		}
		else
		{
			testUdpRegRead2 = false;
		}

		if(UdpParity == TcpParity)
		{
			testUdpRegRead3 = true;
		}
		else
		{
			testUdpRegRead3 = false;
		}

		if(UdpBaudRate == TcpBaudRate)
		{
			testUdpRegRead4 = true;
		}
		else
		{
			testUdpRegRead4 = false;
		}

		my_linkoo->CloseDevice();
	}
	
	catch (CBgaException &e)
    {
		cout << e.what() << endl;
		emessage=e.what();
		testUdpRegRead5 = false;
    }

	return true;
}

///////////////////////////////////////////////////////////
//////////////////// TEST UDP REG READ ////////////////////
///////////////////////////////////////////////////////////



///////////////////////////////////////////////////////////
////////////////// TEST READ WRITE DATA ///////////////////
///////////////////////////////////////////////////////////

bool testReadWriteData()
{

#if BCL_USE_WINDOWS
   
	if(my_linkoo != NULL)
	{
		testReadWriteData0 = true;
	}
	else
	{
		cout << "Connect a device!" << endl;
		testReadWriteData0 = false;
		return false;
	}

	//Set up
	my_linkoo->OpenDevice();
	CSerial     PhysSerial;
	const unsigned int lTestCount = 7;
	long DataToWrite = 0x69696969;
	long DataToRead  = 0x00000000;

	//We use these arrays to keep track of enum values that are pass during our test run.
	CSerial::EBaudrate lBaudRates[lTestCount] = {/*CSerial::EBaud110,
												 CSerial::EBaud300,*/
												CSerial::EBaud1200,
                                                CSerial::EBaud2400,
                                                CSerial::EBaud9600,
                                                CSerial::EBaud19200,
                                                CSerial::EBaud38400,
                                                CSerial::EBaud57600,
                                                CSerial::EBaud115200};
	enumBaudRate       rBaudRates[lTestCount] = {/*e110,
                                                e300,*/
                                               e1200,
                                                e2400,
                                                e9600,
                                                e19200,
                                                e38400,
                                                e57600,
                                                e115200};
	try
    {        
		for(unsigned int i=0; i<lTestCount; i++)
        {
			PhysSerial.Open(_T("COM1"));
			PhysSerial.Setup(lBaudRates[i], CSerial::EData8, CSerial::EParNone, CSerial::EStop1);
			PhysSerial.SetupHandshaking(CSerial::EHandshakeOff);     

			//Send a byte pattern through the serial port and check that we receive
			//it on the Linkoo.
			DataToWrite = 0x69696900+i;
			DataToRead  = 0x00000000;

			my_linkoo->SetBaudRate(rBaudRates[i]);
			my_linkoo->SetDataBits(e8bits);
			my_linkoo->SetParity(eNoParity);
			my_linkoo->SetFlowControl(eNoFlowControl);

			//Test Linkoo Write
			//Always purge the  COM buffer to make sure we don't read in any old debugging data from the firmware.
			PhysSerial.Purge();

			//TBM: Note that we need to insert the sleeps because we are not interrupt-based.
			//     See ticket #41.
			my_linkoo->WriteData(&DataToWrite, sizeof(DataToWrite));
			Sleep(100);
			PhysSerial.Read(&DataToRead, sizeof(DataToRead));

			//Check
			printf("\nLinkoo wrote 0x%lX --- Windows COM read 0x%lX @ %ld bps\n", DataToWrite, DataToRead, rBaudRates[i]);
			if(DataToRead == DataToWrite)
			{
				testReadWriteData1 = true;
			}
			else
			{
				testReadWriteData1 = false;
			}

			//Test Linkoo READ
			DataToWrite = 0x12345600+i;
			DataToRead  = 0xFFFFFFFF;

			//Always purge the  COM buffer to make sure we don't read in any old debugging data from the firmware.
			PhysSerial.Purge();

			//TBM: Note that we need to insert the sleeps because we are not interrupt-based.
			//     See ticket #41.
			PhysSerial.Write(&DataToWrite, sizeof(DataToWrite));
			Sleep(100);
			my_linkoo->ReadData(&DataToRead, sizeof(DataToRead));

			//Check
			printf("\nWindows COM wrote 0x%lX --- Linkoo read 0x%lX @ %ld bps\n", DataToWrite, DataToRead, rBaudRates[i]);
		//	CPPUNIT_ASSERT(DataToRead == DataToWrite);
			if(DataToRead == DataToWrite)
			{
				testReadWriteData2 = true;
			}
			else
			{
				testReadWriteData2 = true;
			}

			PhysSerial.Close();
		}
	}
	
	catch(CBgaException &e)
    {
		cout << e.what() << endl;
		emessage=e.what();
		testReadWriteData3 = false;
    }

	if(PhysSerial.IsOpen())
	{
      PhysSerial.Close();
	}

	my_linkoo->CloseDevice();

#else

   cout << "SQA not yet supported on UNIX platforms" << endl;

#endif

   return true;
}


///////////////////////////////////////////////////////////
////////////////// TEST READ WRITE DATA ///////////////////
///////////////////////////////////////////////////////////




///////////////////////////////////////////////////////////
///////////////// TEST SAVE CONFIGURATION /////////////////
///////////////////////////////////////////////////////////

bool testSaveConfiguration()
{
	if(my_linkoo != NULL)
	{
		testSaveConfiguration0 = true;
	}
	else
	{
		cout << "Connect a device!" << endl;
		testSaveConfiguration0 = false;
		return false;
	}
	
	//process
	try
    {      
		long OriginalDns = my_linkoo->GetNetworkInfo()->GetPrimaryDns();      
		my_linkoo->OpenDevice();
		my_linkoo->GetNetworkInfo()->SaveConfiguration();
		my_linkoo->GetNetworkInfo()->SetPrimaryDns(0xFEABFEAB);
		my_linkoo->GetNetworkInfo()->SaveConfiguration(); 
		my_linkoo->GetNetworkInfo()->SetPrimaryDns(0x00000000);
		my_linkoo->GetNetworkInfo()->LoadConfiguration();

		if(my_linkoo->GetNetworkInfo()->GetPrimaryDns() == 0xFEABFEAB)
		{
			testSaveConfiguration1 = true;
		}
		else
		{
			testSaveConfiguration1 = false;
		}

		my_linkoo->GetNetworkInfo()->SetPrimaryDns(OriginalDns);

		if(my_linkoo->IsOpen())
		{
			my_linkoo->CloseDevice();
		}
	}

	catch(CBgaException &e)
    {
		cout << e.what() << endl;
		emessage=e.what();
		testSaveConfiguration2 = false;
    }

	return true;
}

///////////////////////////////////////////////////////////
///////////////// TEST SAVE CONFIGURATION /////////////////
///////////////////////////////////////////////////////////




///////////////////////////////////////////////////////////
//////////////////// TEST IS AVAILABLE ////////////////////
///////////////////////////////////////////////////////////

bool testIsAvailable()
{
	if(my_linkoo != NULL)
	{
		testIsAvailable0 = true;
	}
	else
	{
		cout << "Connect a device!" << endl;
		testIsAvailable0 = false;
		return false;
	}

	try
    {
		if((my_linkoo->IsAvailable()))
		{
			testIsAvailable1 = true;
		}
		else
		{
			testIsAvailable1 = false;
		}
    }
   
	catch(CBgaException &e)
    {
		cout << e.what() << endl;
		emessage=e.what();
		testIsAvailable2 = false;
    }

	return true;
}

///////////////////////////////////////////////////////////
//////////////////// TEST IS AVAILABLE ////////////////////
///////////////////////////////////////////////////////////




///////////////////////////////////////////////////////////
/////////////////////// MAIN FUNCTION /////////////////////
///////////////////////////////////////////////////////////

int main(int argc, char* argv[]) 
{	
	ofstream File,file;

	char dateStr [9];
    char timeStr [9];
	int n = 1;

	if (argc < 2)
	{
      printf("Usage: Testcase.exe test ...\n");
        return 0;
	}
	
	if(strcmp(argv[1],"test") == 0)
	{	
		File.open("CBgaLinkooTestCases2.ini",ofstream::app);
		File<<"\n[TESTCASES]\n";
		//printf("TESTFILENAME: test1.exe" "\n");
		//File<<"filename="<<argv[0]<<endl;
		_strdate(dateStr);
		//printf("DATE: %s \n", dateStr);
		_strtime( timeStr );
		File<<"dt= "<<dateStr<<" "<<timeStr<<endl;
		//printf("TIME %s \n", timeStr);
		File<<"tc=10"<<endl; //number of test cases in exe file

		for(int i=2; i<argc; i++)
		{	
			//first argument

			////////////////////////////////
			//testing testGetType() function
			////////////////////////////////
			if(strcmp(argv[i],"testGetType") == 0)
			{	
				File<<"[Test " << n << "]" << endl;
				File<<"t1descr=testGetType" << endl;
				File<<"t1dn=3"<< endl; //number of "if" statements in test
				cout<<"Test Case: testGetType"<<endl;

				setUp();
				
				if (testGetType()==false){
					File<<"err=true"<<endl;
					break;
				}

				if(testGetType0 == true)
				{
					File<<"t1d1descr=my_linkoo != NULL" << endl;
					File<<"t1d1=pass" << endl;
					cout << "Test #1 = pass " << endl;
				}
				
				else
				{
					File<<"t1d1descr=my_linkoo != NULL" << endl;
					File<<"t1d1=fail" << endl;
					cout << "Test #1 = fail " << endl;
				}

				if(testGetType1 == true)
				{
					File<<"t1d2descr=my_linkoo->GetType() == eLinkoo || my_linkoo->GetType() == ePICDEM2 || my_linkoo->GetType() == eBouboule" << endl;
					File<<"t1d2=pass" << endl;
					cout << "Test #2 = pass " << endl;
				}
				else
				{
					File<<"t1d2descr=my_linkoo->GetType() == eLinkoo || my_linkoo->GetType() == ePICDEM2 || my_linkoo->GetType() == eBouboule" << endl;
					File<<"t1d2=fail" << endl;
					cout << "Test #2 = fail " << endl;
				}
				if(testGetType2 == false)
				{					
					File<<"t1d3descr="<< emessage<<endl;
					File<<"t1d3=fail" << endl;
					cout << "Test #3 = fail! " << endl;
				}
			
				else
				{
					File<<"t1d3descr=~~" << endl;
					File<<"t1d3=##" << endl;
				}

				if(testGetType0 == true && testGetType1 == true && testGetType2 == true)
				{
					File<<"t1result=pass" << endl;
					cout << "Overall Test Case = pass "<< endl;
				}

				if(testGetType0 == false || testGetType1 == false || testGetType2 == false)
				{
					File<<"t1result=fail" << endl;
					cout << "Overall Test Case = fail "<< endl;
				}

				tearDown();
				n++;
			}

			////////////////////////////////////////////
			//testing testGetMacAddress() function
			////////////////////////////////////////////
			else if(strcmp(argv[i],"testGetMacAddress") == 0)
			{
				File<<"[Test " << n << "]" << endl;
				File<<"t2descr=testGetMacAddress" << endl;
				File<<"t2dn=2"<< endl; //number of "if" statements in test
				cout<<"Test Case: testGetMacAddress"<<endl;

				setUp();
				
				if (testGetMacAddress()==false){
					File<<"err=true"<<endl;
					break;
				}

				if(testGetMacAddress0 == true)
				{
					File<<"t2d1descr=my_linkoo != NULL" << endl;
					File<<"t2d1=pass" << endl;
					cout << "Test #1 = pass " << endl;
				}
				
				else
				{
					File<<"t2d1descr=my_linkoo != NULL" << endl;
					File<<"t2d1=fail" << endl;
					cout << "Test #1 = fail " << endl;
				}

				if(testGetMacAddress0 == true && testGetMacAddress1 == true)
				{
					File<<"t2result=pass" << endl;
					cout << "Overall Test Case = pass "<< endl;
				}
				if(testGetMacAddress1 == false)
				{					
					File<<"t2d2descr="<< emessage<<endl;
					File<<"t2d2=fail" << endl;
					cout << "Test #2 = fail! " << endl;
				}
			
				else
				{
					File<<"t2d2descr=~~" << endl;
					File<<"t2d2=##" << endl;
				}

				if(testGetMacAddress0 == false || testGetMacAddress1 == false)
				{
					File<<"t2result=fail" << endl;
					cout << "Overall Test Case = fail "<< endl;
				}

				tearDown();
				n++;
			}

			///////////////////////////////////////
			//testing testSetGetBaudRate() function
			///////////////////////////////////////
			else if(strcmp(argv[i],"testSetGetBaudRate") == 0)
			{	
				File<<"[Test " << n << "]" << endl;
				File<<"t3descr=testSetGetBaudRate" << endl;
				File<<"t3dn=12"<< endl; //number of "if" statements in test
				cout<<"Test Case: testSetGetBaudRate"<<endl;

				setUp();
				
				if (testSetGetBaudRate()==false){
					File<<"err=true"<<endl;
					break;
				}

				if(testSetGetBaudRate0 == true)
				{
					File<<"t3d1descr=my_linkoo != NULL" << endl;
					File<<"t3d1=pass" << endl;
					cout << "Test #1 = pass " << endl;
				}
				
				else
				{
					File<<"t3d1descr=my_linkoo != NULL" << endl;
					File<<"t3d1=fail" << endl;
					cout << "Test #1 = fail " << endl;
				}

				if(testSetGetBaudRate1 == true)
				{
					File<<"t3d2descr=my_linkoo->GetBaudRate() == e110" << endl;
					File<<"t3d2=pass" << endl;
					cout << "Test #2 = pass " << endl;
				}
				else
				{
					File<<"t3d2descr=my_linkoo->GetBaudRate() == e110" << endl;
					File<<"t3d2=fail" << endl;
					cout << "Test #2 = fail " << endl;
				}

				if(testSetGetBaudRate2 == true)
				{
					File<<"t3d3descr=my_linkoo->GetBaudRate() == e300" << endl;
					File<<"t3d3=pass" << endl;
					cout << "Test #3 = pass " << endl;
				}
				else
				{
					File<<"t3d3=my_linkoo->GetBaudRate() == e300" << endl;
					File<<"t3d3=fail" << endl;
					cout << "Test #3 = fail " << endl;
				}

				if(testSetGetBaudRate3 == true)
				{
					File<<"t3d4descr=my_linkoo->GetBaudRate() == e1200" << endl;
					File<<"t3d4=pass" << endl;
					cout << "Test #4 = pass " << endl;
				}
				else
				{
					File<<"t3d4descr=my_linkoo->GetBaudRate() == e1200" << endl;
					File<<"t3d4=fail" << endl;
					cout << "Test #4 = fail " << endl;
				}

				if(testSetGetBaudRate4 == true)
				{
					File<<"t3d5descr=my_linkoo->GetBaudRate() == e2400" << endl;
					File<<"t3d5=pass" << endl;
					cout << "Test #5 = pass " << endl;
				}
				else
				{
					File<<"t3d5descr=my_linkoo->GetBaudRate() == e2400" << endl;
					File<<"t3d5=fail" << endl;
					cout << "Test #5 = fail " << endl;
				}

				if(testSetGetBaudRate5 == true)
				{
					File<<"t3d6descr=my_linkoo->GetBaudRate() == e4800" << endl;
					File<<"t3d6=pass" << endl;
					cout << "Test #6 = pass " << endl;
				}
				else
				{
					File<<"t3d6descr=my_linkoo->GetBaudRate() == e4800" << endl;
					File<<"t3d6=fail" << endl;
					cout << "Test #6 = fail " << endl;
				}

				if(testSetGetBaudRate6 == true)
				{
					File<<"t3d7descr=my_linkoo->GetBaudRate() == e9600" << endl;
					File<<"t3d7=pass" << endl;
					cout << "Test #7 = pass " << endl;
				}
				else
				{
					File<<"t3d7descr=my_linkoo->GetBaudRate() == e9600" << endl;
					File<<"t3d7=fail" << endl;
					cout << "Test #7 = fail " << endl;
				}

				if(testSetGetBaudRate7 == true)
				{
					File<<"t3d8descr=my_linkoo->GetBaudRate() == e19200" << endl;
					File<<"t3d8=pass" << endl;
					cout << "Test #8 = pass " << endl;
				}
				else
				{
					File<<"t3d8descr=my_linkoo->GetBaudRate() == e19200" << endl;
					File<<"t3d8=fail" << endl;
					cout << "Test #8 = fail " << endl;
				}

				if(testSetGetBaudRate8 == true)
				{
					File<<"t3d9descr=my_linkoo->GetBaudRate() == e38400" << endl;
					File<<"t3d9=pass" << endl;
					cout << "Test #9 = pass " << endl;
				}
				else
				{
					File<<"t3d9descr=my_linkoo->GetBaudRate() == e38400" << endl;
					File<<"t3d9=fail" << endl;
					cout << "Test #9 = fail " << endl;
				}

				if(testSetGetBaudRate9 == true)
				{
					File<<"t3d10descr=my_linkoo->GetBaudRate() == e57600" << endl;
					File<<"t3d10=pass" << endl;
					cout << "Test #10 = pass " << endl;
				}
				else
				{
					File<<"t3d10descr=my_linkoo->GetBaudRate() == e57600" << endl;
					File<<"t3d10=fail" << endl;
					cout << "Test #10 = fail " << endl;

				}
				
				if(testSetGetBaudRate10 == true)
				{
					File<<"t3d11descr=my_linkoo->GetBaudRate() == e115200" << endl;
					File<<"t3d11=pass" << endl;
					cout << "Test #11 = pass " << endl;
				}
				else
				{
					File<<"t3d11descr=my_linkoo->GetBaudRate() == e115200" << endl;
					File<<"t3d11=fail" << endl;
					cout << "Test #11 = fail " << endl;
				}
				if(testSetGetBaudRate11 == false)
				{					
					File<<"t3d12descr="<< emessage<<endl;
					File<<"t3d12=fail" << endl;
					cout << "Test #12 = fail! " << endl;
				}
			
				else
				{
					File<<"t3d12descr=~~" << endl;
					File<<"t3d12=##" << endl;
				}

				if(testSetGetBaudRate0 == true && testSetGetBaudRate1 == true && testSetGetBaudRate2 == true && testSetGetBaudRate3 == true && testSetGetBaudRate4 == true && testSetGetBaudRate5 == true && testSetGetBaudRate6 == true && testSetGetBaudRate7 == true && testSetGetBaudRate8 == true && testSetGetBaudRate9 == true && testSetGetBaudRate10 == true && testSetGetBaudRate11 == true)
				{
					File<<"t3result=pass" << endl;
					cout << "Overall Test Case = pass "<< endl;
				}

				if(testSetGetBaudRate0 == false || testSetGetBaudRate1 == false || testSetGetBaudRate2 == false || testSetGetBaudRate3 == false || testSetGetBaudRate4 == false || testSetGetBaudRate5 == false || testSetGetBaudRate6 == false || testSetGetBaudRate7 == false || testSetGetBaudRate8 == false || testSetGetBaudRate9 == false || testSetGetBaudRate10 == false || testSetGetBaudRate11 == false)
				{
					File<<"t3result=fail" << endl;
					cout << "Overall Test Case = fail "<< endl;
				}

				tearDown();
				n++;
			}

			/////////////////////////////////////
			//testing testSetGetParity() function
			/////////////////////////////////////
			else if(strcmp(argv[i],"testSetGetParity") == 0)
			{
				File<<"[Test " << n << "]" << endl;
				File<<"t4descr=testSetGetParity" << endl;
				File<<"t4dn=5"<< endl; //number of "if" statements in test
				cout<<"Test Case: testSetGetParity"<<endl;

				setUp();
				;
				if (testSetGetParity()==false){
					File<<"err=true"<<endl;
					break;
				}

				if(testSetGetParity0 == true)
				{
					File<<"t4d1descr=my_linkoo != NULL" << endl;
					File<<"t4d1=pass" << endl;
					cout << "Test #1 = pass " << endl;
				}
				
				else
				{
					File<<"t4d1descr=my_linkoo != NULL" << endl;
					File<<"t4d1=fail" << endl;
					cout << "Test #1 = fail " << endl;
				}

				if(testSetGetParity1 == true)
				{
					File<<"t4d2descr=my_linkoo->GetParity() == eNoParity" << endl;
					File<<"t4d2=pass" << endl;
					cout << "Test #2 = pass " << endl;
				}
			
				else
				{
					File<<"t4d2descr=my_linkoo->GetParity() == eNoParity" << endl;
					File<<"t4d2=fail" << endl;
					cout << "Test #2 = fail " << endl;
				}

				if(testSetGetParity2 == true)
				{
					File<<"t4d3descr=my_linkoo->GetParity() == eEvenParity" << endl;
					File<<"t4d3=pass" << endl;
					cout << "Test #3 = pass " << endl;
				}
			
				else
				{
					File<<"t4d3descr=my_linkoo->GetParity() == eEvenParity" << endl;
					File<<"t4d3=fail" << endl;
					cout << "Test #3 = fail " << endl;
				}

				if(testSetGetParity3 == true)
				{
					File<<"t4d4descr=my_linkoo->GetParity() == eOddParity" << endl;
					File<<"t4d4=pass" << endl;
					cout << "Test #4 = pass " << endl;
				}
			
				else
				{
					File<<"t4d4descr=my_linkoo->GetParity() == eOddParity" << endl;
					File<<"t4d4=fail" << endl;
					cout << "Test #4 = fail " << endl;
				}
					if(testSetGetParity4 == false)
				{					
					File<<"t4d5descr="<< emessage<<endl;
					File<<"t4d5=fail" << endl;
					cout << "Test #5 = fail! " << endl;
				}
			
				else
				{
					File<<"t4d5descr=~~" << endl;
					File<<"t4d5=##" << endl;
				}


				if(testSetGetParity0 == true && testSetGetParity1 == true && testSetGetParity2 == true && testSetGetParity3 == true && testSetGetParity4 == true)
				{
					File<<"t4result=pass" << endl;
					cout << "Overall Test Case = pass "<< endl;
				}

				if(testSetGetParity0 == false || testSetGetParity1 == false || testSetGetParity2 == false || testSetGetParity3 == false || testSetGetParity4 == false)
				{
					File<<"t4result=fail" << endl;
					cout << "Overall Test Case = fail "<< endl;
				}

				tearDown();
				n++;
			}

			///////////////////////////////////////
			//testing testSetGetDataBits() function
			///////////////////////////////////////
			else if(strcmp(argv[i],"testSetGetDataBits") == 0)
			{
				File<<"[Test " << n << "]" << endl;
				File<<"t5descr=testSetGetDataBits" << endl;
				File<<"t5dn=4"<< endl; //number of "if" statements in test
				cout<<"Test Case: testSetGetDataBits"<<endl;

				setUp();
			
				if (testSetGetDataBits()==false){
					File<<"err=true"<<endl;
					break;
				}

				if(testSetGetDataBits0 == true)
				{
					File<<"t5d1descr=my_linkoo != NULL" << endl;
					File<<"t5d1=pass" << endl;
					cout << "Test #1 = pass " << endl;
				}
				
				else
				{
					File<<"t5d1descr=my_linkoo != NULL" << endl;
					File<<"t5d1=fail" << endl;
					cout << "Test #1 = fail " << endl;
				}

				if(testSetGetDataBits1 == true)
				{
					File<<"t5d2descr=my_linkoo->GetDataBits() == e7bits" << endl;
					File<<"t5d2=pass" << endl;
					cout << "Test #2 = pass " << endl;
				}
			
				else
				{
					File<<"t15d2=my_linkoo->GetDataBits() == e7bits" << endl;
					File<<"t15d2=fail" << endl;
					cout << "Test #2 = fail " << endl;
				}

				if(testSetGetDataBits2 == true)
				{
					File<<"t5d3descr=my_linkoo->GetDataBits() == e8bits" << endl;
					File<<"t5d3=pass" << endl;
					cout << "Test #3 = pass " << endl;
				}
			
				else
				{
					File<<"t5d3descr=my_linkoo->GetDataBits() == e8bits" << endl;
					File<<"t5d3=fail" << endl;
					cout << "Test #3 = fail " << endl;
				}
					if(testSetGetDataBits3 == false)
				{					
					File<<"t5d4descr="<< emessage<<endl;
					File<<"t5d4=fail" << endl;
					cout << "Test #4 = fail! " << endl;
				}
			
				else
				{
					File<<"t5d4descr=~~" << endl;
					File<<"t5d4=##" << endl;
				}


				if(testSetGetDataBits0 == true && testSetGetDataBits1 == true && testSetGetDataBits2 == true && testSetGetDataBits3 == true)
				{
					File<<"t5result=pass" << endl;
					cout << "Overall Test Case = pass "<< endl;
				}

				if(testSetGetDataBits0 == false || testSetGetDataBits1 == false || testSetGetDataBits2 == false || testSetGetDataBits3 == false)
				{
					File<<"t5result=fail" << endl;
					cout << "Overall Test Case = fail "<< endl;
				}

				tearDown();
				n++;
			}

			//////////////////////////////////////////
			//testing testSetGetFlowControl() function
			//////////////////////////////////////////
			else if(strcmp(argv[i],"testSetGetFlowControl") == 0)
			{
				File<<"[Test " << n << "]" << endl;
				File<<"t6descr=testSetGetFlowControl" << endl;
				File<<"t6dn=5"<< endl; //number of "if" statements in test
				cout<<"Test Case: testSetGetFlowControl"<<endl;

				setUp();
				
				if (testSetGetFlowControl()==false){
					File<<"err=true"<<endl;
					break;
				}

				if(testSetGetFlowControl0 == true)
				{
					File<<"t6d1descr=my_linkoo != NULL" << endl;
					File<<"t6d1=pass" << endl;
					cout << "Test #1 = pass " << endl;
				}
				
				else
				{
					File<<"t6d1descr=my_linkoo != NULL" << endl;
					File<<"t6d1=fail" << endl;
					cout << "Test #1 = fail " << endl;
				}

				if(testSetGetFlowControl1 == true)
				{
					File<<"t6d2descr=my_linkoo->GetFlowControl() == eNoFlowControl" << endl;
					File<<"t6d2=pass" << endl;
					cout << "Test #2 = pass " << endl;

				}
			
				else
				{
					File<<"t6d2descr=my_linkoo->GetFlowControl() == eNoFlowControl" << endl;
					File<<"t6d2=fail" << endl;
					cout << "Test #2 = fail " << endl;
				}

				if(testSetGetFlowControl2 == true)
				{
					File<<"t6d3descr=my_linkoo->GetFlowControl() == eHardwareFlowControl" << endl;
					File<<"t6d3=pass" << endl;
					cout << "Test #3 = pass " << endl;

				}
			
				else
				{
					File<<"t6d3descr=my_linkoo->GetFlowControl() == eHardwareFlowControl" << endl;
					File<<"t6d3=fail" << endl;
					cout << "Test #3 = fail " << endl;
				}

				if(testSetGetFlowControl3 == true)
				{
					File<<"t6d4descr=my_linkoo->GetFlowControl() == eSoftwareFlowControl" << endl;
					File<<"t6d4=pass" << endl;
					cout << "Test #4 = pass " << endl;

				}
			
				else
				{
					File<<"t6d4descr=my_linkoo->GetFlowControl() == eSoftwareFlowControl" << endl;
					File<<"t6d4=fail" << endl;
					cout << "Test #4 = fail " << endl;
				}
				
				if(testSetGetFlowControl4 == false)
				{					
					File<<"t6d5descr="<< emessage<<endl;
					File<<"t6d5=fail" << endl;
					cout << "Test #5 = fail! " << endl;
				}
			
				else
				{
					File<<"t6d5descr=~~" << endl;
					File<<"t6d5=##" << endl;
				}

				if(testSetGetFlowControl0 == true && testSetGetFlowControl1 == true && testSetGetFlowControl2 == true && testSetGetFlowControl3 == true && testSetGetFlowControl4 == true)
				{
					File<<"t6result=pass" << endl;
					cout << "Overall Test Case = pass "<< endl;

				}

				if(testSetGetFlowControl0 == false || testSetGetFlowControl1 == false || testSetGetFlowControl2 == false || testSetGetFlowControl3 == false || testSetGetFlowControl4 == false)
				{
					File<<"t6result=fail" << endl;
					cout << "Overall Test Case = fail "<< endl;

				}

				tearDown();
				n++;
			}

			///////////////////////////////////
			//testing testUdpRegRead() function
			///////////////////////////////////
			else if(strcmp(argv[i],"testUdpRegRead") == 0)
			{
				File<<"[Test " << n << "]" << endl;
				File<<"t7descr=testUdpRegRead" << endl;
				File<<"t7dn=6"<< endl; //number of "if" statements in test
				cout<<"Test Case: testUdpRegRead"<<endl;

				setUp();
				
				if (testUdpRegRead()==false){
					File<<"err=true"<<endl;
					break;
				}

				if(testUdpRegRead0 == true)
				{
					File<<"t7d1descr=my_linkoo != NULL" << endl;
					File<<"t7d1=pass" << endl;
					cout << "Test #1 = pass " << endl;
				}
				
				else
				{
					File<<"t7d1descr=my_linkoo != NULL" << endl;
					File<<"t7d1=fail" << endl;
					cout << "Test #1 = fail " << endl;
				}

				if(testUdpRegRead1 == true)
				{
					File<<"t7d2descr=UdpFlowControl == TcpFlowControl" << endl;
					File<<"t7d2=pass" << endl;
					cout << "Test #2 = pass " << endl;
				}
			
				else
				{
					File<<"t7d2descr=UdpFlowControl == TcpFlowControl" << endl;
					File<<"t7d2=fail" << endl;
					cout << "Test #2 = fail " << endl;
				}

				if(testUdpRegRead2 == true)
				{
					File<<"t7d3descr=UdpDataBits == TcpDataBits" << endl;
					File<<"t7d3=pass" << endl;
					cout << "Test #3 = pass " << endl;
				}
			
				else
				{
					File<<"t7d3descr=UdpDataBits == TcpDataBits" << endl;
					File<<"t7d3=fail" << endl;
					cout << "Test #3 = fail " << endl;
				}

				if(testUdpRegRead3 == true)
				{
					File<<"t7d4descr=UdpParity == TcpParity" << endl;
					File<<"t7d4=pass" << endl;
					cout << "Test #4 = pass " << endl;
				}
			
				else
				{
					File<<"t7d4descr=UdpParity == TcpParity" << endl;
					File<<"t7d4=fail" << endl;
					cout << "Test #4 = fail " << endl;
				}

				if(testUdpRegRead4 == true)
				{
					File<<"t7d5descr=UdpBaudRate == TcpBaudRate" << endl;
					File<<"t7d5=pass" << endl;
					cout << "Test #5 = pass " << endl;
				}
			
				else
				{
					File<<"t7d5descr=UdpBaudRate == TcpBaudRate" << endl;
					File<<"t7d5=fail" << endl;
					cout << "Test #5 = fail " << endl;

				}
				if(testUdpRegRead5 == false)
				{					
					File<<"t7d6descr="<< emessage<<endl;
					File<<"t7d6=fail" << endl;
					cout << "Test #6 = fail! " << endl;
				}
			
				else
				{
					File<<"t7d6descr=~~" << endl;
					File<<"t7d6=##" << endl;
				}

				if(testUdpRegRead0 == true && testUdpRegRead1 == true && testUdpRegRead2 == true && testUdpRegRead3 == true && testUdpRegRead4 == true && testUdpRegRead5 == true)
				{
					File<<"t7result=pass" << endl;
					cout << "Overall Test Case = pass "<< endl;
				}

				if(testUdpRegRead0 == false || testUdpRegRead1 == false || testUdpRegRead2 == false || testUdpRegRead3 == false || testUdpRegRead4 == false || testUdpRegRead5 == false)
				{
					File<<"t7result=fail" << endl;
					cout << "Overall Test Case = fail "<< endl;
				}

				tearDown();
				n++;
			}

			//////////////////////////////////////
			//testing testReadWriteData() function
			//////////////////////////////////////
			else if(strcmp(argv[i],"testReadWriteData") == 0)
			{
				File<<"[Test " << n << "]" << endl;
				File<<"t8descr=testReadWriteData" << endl;
				File<<"t8dn=4"<< endl; //number of "if" statements in test
				cout<<"Test Case: testReadWriteData"<<endl;

				setUp();
				
				if (testReadWriteData()==false){
					File<<"err=true"<<endl;
					break;
				}

				if(testReadWriteData0 == true)
				{
					File<<"t8d1descr=my_linkoo != NULL" << endl;
					File<<"t8d1=pass" << endl;
					cout << "Test #1 = pass " << endl;
				}
				
				else
				{
					File<<"t8d1descr=my_linkoo != NULL" << endl;
					File<<"t8d1=fail" << endl;
					cout << "Test #1 = fail " << endl;
				}

				if(testReadWriteData1 == true)
				{
					File<<"t8d2descr=DataToRead == DataToWrite" << endl;
					File<<"t8d2=pass" << endl;
					cout << "Test #2 = pass " << endl;
				}
			
				else
				{
					File<<"t8d2descr=DataToRead == DataToWrite" << endl;
					File<<"t8d2=fail" << endl;
					cout << "Test #2 = fail " << endl;
				}

				if(testReadWriteData2 == true)
				{
					File<<"t8d3descr=DataToRead == DataToWrite" << endl;
					File<<"t8d3=pass" << endl;
					cout << "Test #3 = pass " << endl;
				}
			
				else
				{
					File<<"t8d3descr=DataToRead == DataToWrite" << endl;
					File<<"t8d3=fail" << endl;
					cout << "Test #3 = fail " << endl;
				}

				if(testReadWriteData3 == false)
				{					
					File<<"t8d4descr="<< emessage<<endl;
					File<<"t8d4=fail" << endl;
					cout << "Test #4 = fail! " << endl;
				}
			
				else
				{
					File<<"t8d4descr=~~" << endl;
					File<<"t8d4=##" << endl;
				}

				if(testReadWriteData0 == true && testReadWriteData1 == true && testReadWriteData2 == true && testReadWriteData3 == true)
				{
					File<<"t8result=pass" << endl;
					cout << "Overall Test Case = pass "<< endl;
				}

				if(testReadWriteData0 == false || testReadWriteData1 == false || testReadWriteData2 == false || testReadWriteData3 == false)
				{
					File<<"t8result=fail" << endl;
					cout << "Overall Test Case = fail "<< endl;
				}

				tearDown();
				n++;
			}

			//////////////////////////////////////////
			//testing testSaveConfiguration() function
			//////////////////////////////////////////
			else if(strcmp(argv[i],"testSaveConfiguration") == 0)
			{
				File<<"[Test " << n << "]" << endl;
				File<<"t9descr=testSaveConfiguration" << endl;
				File<<"t9dn=3"<< endl; //number of "if" statements in test
				cout<<"Test Case: testSaveConfiguration"<<endl;

				setUp();
				
				if (testSaveConfiguration()==false){
					File<<"err=true"<<endl;
					break;
				}

				if(testSaveConfiguration0 == true)
				{
					File<<"t9d1descr=my_linkoo != NULL" << endl;
					File<<"t9d1=pass" << endl;
					cout << "Test #1 = pass " << endl;
				}
				
				else
				{
					File<<"t9d1descr=my_linkoo != NULL" << endl;
					File<<"t9d1=fail" << endl;
					cout << "Test #1 = fail " << endl;
				}
				
				if(testSaveConfiguration1 == true)
				{
					File<<"t9d2descr=GetPrimaryDns() == 0xFEABFEAB" << endl;
					File<<"t9d2=pass" << endl;
					cout << "Test #2 = pass " << endl;
				}
				else
				{
					File<<"t9d2descr=GetPrimaryDns() == 0xFEABFEAB" << endl;
					File<<"t9d2=fail" << endl;
					cout << "Test #2 = fail " << endl;
				}

				if(testSaveConfiguration2 == false)
				{					
					File<<"t9d3descr="<< emessage<<endl;
					File<<"t9d3=fail" << endl;
					cout << "Test #3 = fail! " << endl;
				}
			
				else
				{
					File<<"t9d3descr=~~" << endl;
					File<<"t9d3=##" << endl;
				}

				if(testSaveConfiguration0 == true && testSaveConfiguration1 == true && testSaveConfiguration2 == true)
				{
					File<<"t9result=pass" << endl;
					cout << "Overall Test Case = pass "<< endl;
				}

				if(testSaveConfiguration0 == false || testSaveConfiguration1 == false || testSaveConfiguration2 == false)
				{
					File<<"t9result=fail" << endl;
					cout << "Overall Test Case = fail "<< endl;
				}

				tearDown();
				n++;
			}

			////////////////////////////////////
			//testing testIsAvailable() function
			////////////////////////////////////
			else if(strcmp(argv[i],"testIsAvailable") == 0)
			{
				File<<"[Test " << n << "]" << endl<<"t10descr=testIsAvailable" << endl;
				File<<"t10dn=3"<< endl; //number of "if" statements in test
				cout<<"Test Case: testIsAvailable"<<endl;

				setUp();
				
				if (testIsAvailable()==false){
					File<<"err=true"<<endl;
					break;
				}

				if(testIsAvailable0 == true)
				{
					File<<"t10d1descr=my_linkoo != NULL" << endl;
					File<<"t10d1=pass" << endl;
					cout << "Test #1 = pass " << endl;
				}
				
				else
				{
					File<<"t10d1descr=my_linkoo != NULL" << endl;
					File<<"t10d1=fail" << endl;
					cout << "Test #1 = fail " << endl;
				}
				
				if(testIsAvailable1 == true)
				{
					File<<"t10d2=my_linkoo->IsAvailable()" << endl;
					File<<"t10d2=pass" << endl;
					cout << "Test #2 = pass " << endl;
				}
				else
				{
					File<<"t10d2descr=my_linkoo->IsAvailable()" << endl;
					File<<"t10d2=fail" << endl;
					cout << "Test #2 = fail " << endl;
				}
				if(testIsAvailable2 == false)
				{					
					File<<"t10d3descr="<< emessage<<endl;
					File<<"t10d3=fail" << endl;
					cout << "Test #3 = fail! " << endl;
				}
			
				else
				{
					File<<"t10d3descr=~~" << endl;
					File<<"t10d3=##" << endl;
				}

				if(testIsAvailable0 == true && testIsAvailable1 == true && testIsAvailable2 == true)
				{
					File<<"t10result=pass" << endl;
					cout << "Overall Test Case = pass "<< endl;
				}

				if(testIsAvailable0 == false || testIsAvailable1 == false || testIsAvailable2 == false)
				{
					File<<"t10result=fail" << endl;
					cout << "Overall Test Case = fail "<< endl;
				}

				tearDown();
				n++;
			}

		}
		
		 File.close();
	}

	else if(strcmp(argv[1],"list") == 0)
	{	
		File.open("CBgaLinkooTestCases2.ini");
			
		File<<"[list]\n";
				File<<"count=10"<<endl; //number of test cases in exe file


		File<<"Test1=testGetType" << endl;
		File<<"Test2=testGetMacAddress" << endl;
		File<<"Test3=testSetGetBaudRate" << endl;
		File<<"Test4=testSetGetParity" << endl;
		File<<"Test5=testSetGetDataBits" << endl;
		File<<"Test6=testSetGetFlowControl" << endl;
		File<<"Test7=testReadWriteData" << endl;
		File<<"Test8=testUdpRegRead" << endl;
		File<<"Test9=testSaveConfiguration" << endl;
		File<<"Test10=testIsAvailable" << endl;

		cout << "Here are a list of Tests available: \n1) testGetType\n2) testGetMacAddress\n3) testSetGetBaudRate\n4) testSetGetParity\n5) testSetGetDataBits\n6) testSetGetFlowControl" << endl;
		cout << "7) testReadWriteData\n8) testUdpRegRead\n9) testSaveConfiguration\n10) testIsAvailable" << endl;

		File.close();
	}

	return 0;
}


///////////////////////////////////////////////////////////
/////////////////////// MAIN FUNCTION /////////////////////
///////////////////////////////////////////////////////////